package com.dongdongshop.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbBrandMapper;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.pojo.TbBrandExample;
import com.dongdongshop.service.BrandServiceI;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Service
public class BrandServiceImpl implements BrandServiceI {
   @Resource
   private TbBrandMapper tbBrandMappe;

    @Override
    public int updateBrand(TbBrand tbBrand) {
        return tbBrandMappe.updateByPrimaryKeySelective(tbBrand);
    }

    @Override
    public TbBrand getBrandById(Long id) {
        return tbBrandMappe.selectByPrimaryKey(id);
    }

    @Override
    public int deleteBrand(Integer[] ids) {
        return tbBrandMappe.deleteBrands(ids);
    }

    @Override
    public int addBrand(TbBrand brand) {
        return tbBrandMappe.insertSelective(brand);
    }

    @Override
    public List<TbBrand> listBrands() {
        return tbBrandMappe.selectByExample(new TbBrandExample());
    }
}
